{% extends "pm/base.html" %}

{% block pm_breadcrumb %}
<li class="breadcrumb-item active" aria-current="page">所有报告</li>
{% endblock %}

{% block content %}


    <div class="container">
        <div class="panel panel-primary">
            <div class="panel-heading">所有报告</div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table class="table table-condensed"
                           data-toggle="table"
                           data-show-export="true"
                           id="table"
                           data-toolbar="#toolbar"
                           data-search="true"
                           data-show-columns="true"
                           data-advanced-search="true"
                           data-show-fullscreen="true"
                           data-click-to-select="true"
                           data-detail-formatter="detailFormatter"
                           data-minimum-count-columns="2"
                           data-id-table="advancedTable"
                           data-search-highlight="true"
                           data-show-search-clear-button="true"
                           data-sort-name="name"
                           data-show-footer="true">
                        <thead>
                        <tr>
                            <th>客户名称</th>
                            <th>部门</th>
                            <th>仪器名称</th>
                            <th>仪器型号</th>
                            <th>仪器序列号</th>
                            <th>报告日期</th>
                            <th>下载</th>
                            <th>删除</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for report in reports %}
                            <tr>
                                <td>{{ report.customer_name }}</td>
                                <td>{{ report.department }}</td>
                                <td>{{ report.instrument_name }}</td>
                                <td>{{ report.instrument_model }}</td>
                                <td>{{ report.instrument_serial }}</td>
                                <td>{{ report.report_date }}</td>
                                <td><a class='btn btn-success btn-xs'
                                       href="{% url 'download_report' report.id %}">下载</a></td>
                                <td><a class='btn btn-danger btn-xs'
                                       href="{% url 'delete_report' report.id %}">删除</a></td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            {% if page_obj.has_previous %}
                                <li class="page-item">
                                    <a class="page-link" href="?page={{ page_obj.previous_page_number }}"
                                       aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                            {% else %}
                                <li class="page-item disabled">
                                    <a class="page-link" href="#" aria-label="Previous">
                                        <span aria-hidden="true">&laquo;</span>
                                    </a>
                                </li>
                            {% endif %}

                            {% for num in page_obj.paginator.page_range %}
                                {% if page_obj.number == num %}
                                    <li class="page-item active">
                                        <a class="page-link" href="?page={{ num }}">{{ num }}</a>
                                    </li>
                                {% else %}
                                    <li class="page-item">
                                        <a class="page-link" href="?page={{ num }}">{{ num }}</a>
                                    </li>
                                {% endif %}
                            {% endfor %}

                            {% if page_obj.has_next %}
                                <li class="page-item">
                                    <a class="page-link" href="?page={{ page_obj.next_page_number }}" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                            {% else %}
                                <li class="page-item disabled">
                                    <a class="page-link" href="#" aria-label="Next">
                                        <span aria-hidden="true">&raquo;</span>
                                    </a>
                                </li>
                            {% endif %}
                        </ul>
                    </nav>
                </div>

            </div>
        </div>
    </div>

{% endblock %}